Skip to content

Conversation

@BrewTestBot
Copy link
Member

Created by brew bump


Created with brew bump-formula-pr.

release notes
## Major Changes

Portable Types

In #1266, we added support for transpiling portable integer types like size_t and uint64_t. Previously, these were translated in a platform-dependent way, as C defines these portable types as typedefs of the platform-dependent primitive types like int and long.
Now we special case these portable integer types and make sure to translate them as the equivalent Rust portable types, so size_t becomes usize and uint64_t becomes u64, for example.

These still often go through multiple typedefs in C, which become multiple type aliases in Rust, so the definitions are not always textually identical in Rust, but the underlying types should always be portable now.

Const Macros

We previously had an unstable and often broken --translate-const-macros option, which translated const/object-like C macros as Rust consts. This has now been significantly improved and --translate-const-macros conservative is enabled by default. The option has been split into none, conservative, and experimental, so we still allow the previous more experimental translations under experimental, but conservative should generally work and thus is enabled by default. However, some const macros are not yet translatable, like macros referencing other variables, functions, etc., which conservative skips, while some const macros can never be properly translated as a Rust const, such as when it references a variable that is not yet defined. We're still working on improving these cases so that more const macros can be successfully translated, but the current version should capture most usages in the wild. For tmux, 98% of const macro definitions and expansions are successfully translated, for example.

One area in particular we're still working on is the combination of const macros and portable types. The features don't yet work together seamlessly, with const macro types using the old non-portable types and then casting to the portable type at use sites.

SrcLoc Sorting

On stable, sorting now panics when a non-total order is discovered, which was the case in fn compare_src_locs. We had previously tried to fix this, and fixed it in a bunch of cases, but it was still cropping up sometimes, like when transpiling libxml2.

We've now fixed the root cause of incorrect SrcLoc::fileids when we calculate #include paths. Besides fixing any panics, this should improve the sorting of items, which was sometimes buggy before, likely due to this.

cmake 4.0 Support

#1214 adds support for cmake 4.0 by increasing the minimum to cmake 3.5. This should fix any installation issues due to using a new cmake.

LLVM/Clang Support

  • (#1243, #1244) LLVM 18
  • (#1230) LLVM 19
  • (#1248) LLVM 20
  • (#1274) LLVM 21

Misc. Bug Fixes

  • (#1265) Handle all cases of extra braces in string initializers.
  • (#1340) Remove extraneous :: separators in paths with arguments (e.g. ::core::mem::size_of::<libc::c_int>::()).
  • (#1359) Store alloca vector at function-level scope, matching C.
  • (#1360) Avoid mutable transmutes (UB) for string literals (mem::transmute::<[u8; N], [c_char; N]>(*b"") instead of *mem::transmute::<&[u8; N], &mut [c_char; N]>(b"")).
  • (#1361) Support anonymous struct/union/enums within structs and unions.
  • (#1374) Inline asm fixes for ioq3.

Misc. Improvements

  • (#1221, #1222, #1229, #1381) Prefer core:: over libc:: and std::, fixing --emit-no-std.
  • (#1218) Prefer [x; N] over [x, ..., x].
  • (#1344) Skip redundant expressions for ++ and -- (i += 1; i; vs. i += 1;).
  • (#1373) use libc only when needed.

New Instrinsics Added

  • (#814) C11 atomics
  • (#1342) _Static_assert
  • (#1235) __float128
  • (#1259, #1260) __builtin_rotateright*
  • (#1263, #1292) __builtin_ia32_pause
  • (#1263, #1292) __builtin_arm_yield
  • (#1129) __builtin_ia32_vperm2f128_pd256
  • (#1129) _mm256_permute2f128_pd

Changelog

New Contributors

Also, many thanks to @Rua and @bungcip for helping us fix a ton of bugs!

Full Changelog: immunant/c2rust@v0.20.0...v0.21.0

View the full release notes at https://github.com/immunant/c2rust/releases/tag/v0.21.0.


@github-actions github-actions bot added rust Rust use is a significant feature of the PR or issue bump-formula-pr PR was created using `brew bump-formula-pr` labels Oct 8, 2025
c2rust: remove build patch

Signed-off-by: Rui Chen <[email protected]>
@github-actions
Copy link
Contributor

github-actions bot commented Oct 9, 2025

🤖 An automated task has requested bottles to be published to this PR.

Caution

Please do not push to this PR branch before the bottle commits have been pushed, as this results in a state that is difficult to recover from. If you need to resolve a merge conflict, please use a merge commit. Do not force-push to this PR branch.

@github-actions github-actions bot added the CI-published-bottle-commits The commits for the built bottles have been pushed to the PR branch. label Oct 9, 2025
@BrewTestBot BrewTestBot enabled auto-merge October 9, 2025 01:32
@BrewTestBot BrewTestBot added this pull request to the merge queue Oct 9, 2025
Merged via the queue into main with commit b96f4bf Oct 9, 2025
22 checks passed
@BrewTestBot BrewTestBot deleted the bump-c2rust-0.21.0 branch October 9, 2025 01:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bump-formula-pr PR was created using `brew bump-formula-pr` CI-published-bottle-commits The commits for the built bottles have been pushed to the PR branch. rust Rust use is a significant feature of the PR or issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants